package com.phx.serialjni;
import android.graphics.Rect;

import java.util.HashMap;
import java.util.Map;

public class PageJ {
    static int pageno ;
    static int pageback ;

    static Integer[] nodeArray;

    Integer[] resArray ;
    Integer[] seqArray ;
    static Integer[] offArray ;

    static Integer[] onArray ;

    static String[] cmdArray  ;
    static String[] actArray  ;
    static  Integer[] typeArray;
    static String[] feedDArray;

    int mleft = 1204;
    int mtop = 600;
    int mwidth = 144;
    int mheight = 145;
    static int jmpPosition = 0;
    static Rect[]  allRect;


    public  static HashMap<String, String> feedMap = new HashMap<String, String>();



    public int getCountx() {
        return seqArray.length;
    }


    public static void setfeeds() {


        String[] feedDArrayx0 = new String[]{"", "", "", "", "", "", "00d1", "0002", "0072"};
        setfeedinit(feedDArrayx0);

    }

    public static void setfeedinit(String[] myDArrayx)
    {
        int vv = myDArrayx.length;
        for (int x=0; x<vv; x++) {
            if(!myDArrayx[x].equals("")) {
                feedMap.put(myDArrayx[x],"0000");
            }
        }
    }

    public void s0() {
        pageno = 0;
        pageback = R.drawable.totalui;


        jmpPosition = 0;
        seqArray = new Integer[]{1, 2, 3, 4, 5, 6, 7,8,9,10};
        typeArray = new Integer[]{29, 29, 29, 28, 29, 29, 29, 29, 29,29};
        cmdArray = new String[]{"1","com.kugou.android","3","mycontrol","5",
                "D1E00000",
                "com.baidu.browser",
                "F310000E",
                "F210000E",""};
        actArray = new String[]{"1","com.kugou.android.app.splash.SplashActivity","MainActivityx","4","com.baidu.browser.framework.BdBrowserActivity",
                "D1E00000",
                "com.baidu.browser.framework.BdBrowserActivity",
                "F310000E",
                "F210000E",""};
        nodeArray = new Integer[]{1, 1, 1, 1, 1, 1, 1, 1, 1,1};
        feedDArray = new String[]{"", "", "", "00b1", "0072", "00d1", "00d2","00f3","00f2",""};

        offArray = new Integer[]{R.drawable.b1_off, R.drawable.b2_off, R.drawable.b3_off,  };

        onArray = new Integer[]{R.drawable.b1_on, R.drawable.b2_on, R.drawable.b3_on,  };
//1024 600

        allRect = new Rect[10];
        allRect[0] = new Rect(34, 412, 34 + 119, 412 + 114);
        allRect[1] = new Rect(166, 412, 166 + 119, 412 + 114);
        allRect[2] = new Rect(298, 412, 298 + 119, 412 + 114);
        allRect[3] = new Rect(430, 412, 430 + 119, 412 + 114);
        allRect[4] = new Rect(563, 412, 563 + 119, 412 + 114);
        allRect[5] = new Rect(695, 412, 695 + 119, 412 + 114);
        allRect[6] = new Rect(827, 412, 827 + 119, 412 + 114);
        allRect[7] = new Rect(689, 251, 689 + 119, 251 + 114);
        allRect[8] = new Rect(824, 251, 824 + 119, 251 + 114);

        allRect[9] = new Rect(794, 108, 794 + 119, 108 + 114);
    }


    public void s1() {
        pageno = 1;
        pageback = R.drawable.a2;
        jmpPosition = 1;

        seqArray = new Integer[]{1, 2, 3, 4, 5, 6, 7,8,9};
        cmdArray = new String[]{"0","2","3","4","5",
                "D1200009",
                "C1E00009",
                "7161000E",
                "B161000E"};
        feedDArray = new String[]{"", "", "", "", "", "00b2", "00b2","00b3","01b3"};
        nodeArray = new Integer[]{1, 1, 1, 1, 1, 0, 0, 0, 0};
        typeArray = new Integer[]{20, 20, 20, 20, 20, 19, 19, 19, 19};
        offArray = new Integer[]{R.drawable.c1_off, R.drawable.c2_off, R.drawable.c3_off, R.drawable.c4_off,
                R.drawable.c5_off, R.drawable.c6_off, R.drawable.e1_off,R.drawable.c6_off, R.drawable.e1_off};

        onArray = new Integer[]{R.drawable.c1_on, R.drawable.c2_on, R.drawable.c3_on, R.drawable.c4_on,
                R.drawable.c5_on, R.drawable.c6_on, R.drawable.e1_on,R.drawable.c6_on, R.drawable.e1_on};


        allRect = new Rect[9];
        allRect[0] = new Rect(140, 1242, 140 + 190, 1242 + 160);
        allRect[1] = new Rect(765, 1242, 765 + 190, 1242 + 160);
        allRect[2] = new Rect(1080, 1242, 1080 + 190, 1242 + 160);
        allRect[3] = new Rect(1395, 1242, 1395 + 190, 1242 + 160);
        allRect[4] = new Rect(1708, 1242, 1708 + 190, 1242 + 160);
        allRect[5] = new Rect(152, 681, 152 + 139, 681 + 121);
        allRect[6] = new Rect(768, 681, 768 + 139, 681 + 121);
        allRect[7] = new Rect(1164, 681, 1164 + 139, 681 + 121);
        allRect[8] = new Rect(1780, 681, 1780 + 139, 681 + 121);
        // setfeedinit();

    }

    public void s2() {
        pageno = 2;
        pageback = R.drawable.a3;
        jmpPosition = 1;

        seqArray = new Integer[]{1, 2, 3, 4, 5, 6, 7,8,9};
        cmdArray = new String[]{"0","1","3","4","5",
                "71802003",
                "01102003",
                "02102003",
                "72502003"};
        feedDArray = new String[]{"", "", "", "","", "", "00d1", "0002","0072"};
        // feedStatus = new String[]{"", "", "", "","", "", "0001", "0002","0072"}; //仅本页有效
        nodeArray = new Integer[]{1, 1, 1, 1, 1, 1, 0, 0, 0};
        typeArray = new Integer[]{20, 20, 20, 20, 20, 19, 16, 16, 16};
        offArray = new Integer[]{R.drawable.c1_off, R.drawable.c2_off, R.drawable.c3_off, R.drawable.c4_off,
                R.drawable.c5_off, R.drawable.c6_off, R.drawable.c3_off,R.drawable.c6_off, R.drawable.c3_off};

        onArray = new Integer[]{R.drawable.c1_on, R.drawable.c2_on, R.drawable.c3_on, R.drawable.c4_on,
                R.drawable.c5_on, R.drawable.c6_on, R.drawable.c3_on,R.drawable.c6_on, R.drawable.c3_on};

        allRect = new Rect[9];
        allRect[0] = new Rect(140, 1242, 140 + 190, 1242 + 160);
        allRect[1] = new Rect(451, 1242, 451 + 190, 1242 + 160);
        allRect[2] = new Rect(1080, 1242, 1080 + 190, 1242 + 160);
        allRect[3] = new Rect(1395, 1242, 1395 + 190, 1242 + 160);
        allRect[4] = new Rect(1708, 1242, 1708 + 190, 1242 + 160);
        allRect[5] = new Rect(269, 543, 269 + 185, 543 + 399);
        allRect[6] = new Rect(774, 608, 774 + 141, 608 + 139);
        allRect[7] = new Rect(1204, 600, 1204 + 144, 600 + 145);
        allRect[8] = new Rect(1651, 447, 1651 + 185, 447 + 339);

        //反馈状态初始化显示
        //根绝接收的反馈信息变换状态


        // setfeedinit();
    }


    public void setInit(int currentPage) {

        switch (currentPage) {
            case 0:
                s0();
                break;
            case 1:
                s1();
                break;
            case  2:
                s2();
                break;
            default:
                break;
        }
    }



}

